/*
 * clog_rule.h
 *
 *  Created on: 2012-8-18
 *      Author: lin
 */

#ifndef CLOG_RULE_H_
#define CLOG_RULE_H_

#include "def/defs.h"
#include "clog_level.h"
#include "clog_format.h"
#include "clog_event.h"
#include "clog_thread_local.h"

typedef struct {
    char *category;
    char *static_path;
    int static_fd;
    int32_t file_perms;

    int32_t level;
    uint64_t level_mask;


    int32_t buf_len;
    char compare_char;

    char *buf_pos;
    char buf[0];
} clog_rule_t;

clog_rule_t *clog_rule_new(const char *category_name, const char *args);
void clog_rule_free(clog_rule_t *rule);
clog_rule_t *clog_rule_dup(const clog_rule_t *src);

int clog_rule_output(clog_rule_t *rule,clog_event_t *event,clog_thread_local_t *local);

#endif /* CLOG_RULE_H_ */
